<?php

namespace Fronts\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use Fronts\Model\Catalog;
use Fronts\Model\Videos;
use Fronts\Model\Link;

class ElementsController extends AbstractActionController {

    private $CatalogTable;
    private $VideosTable;
    private $LinkTable;

    private function getCatalogTable() {
        if (!$this->CatalogTable) {
            $pst = $this->getServiceLocator();
            $this->CatalogTable = $pst->get("Fronts\Model\CatalogTable");
        }
        return $this->CatalogTable;
    }

    private function getVideosTable() {
        if (!$this->VideosTable) {
            $pst = $this->getServiceLocator();
            $this->VideosTable = $pst->get("Fronts\Model\VideosTable");
        }
        return $this->VideosTable;
    }

    private function getLinkTable() {
        if (!$this->LinkTable) {
            $pst = $this->getServiceLocator();
            $this->LinkTable = $pst->get("Fronts\Model\LinkTable");
        }
        return $this->LinkTable;
    }

    public function menuAction() {
        $listmenu = $this->getCatalogTable()->loadcatalog(-1);
        return $listmenu;
    }

    public function widgetvideosnewsAction() {
        $listvideosnew = $this->getVideosTable()->widgetvideosnew();
        return $listvideosnew;
    }

    public function widgetlinkAction() {
        $listLink = $this->getLinkTable()->loadlink();
        return $listLink;
    }

}
